/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef HISPORT_H
#define HISPORT_H

#include "interface/i_hisport.h"
#include "internal/bus/bus_base/bus.h"
#include "internal/hasdef.h"
#include <mc/engine.h>
#include <memory>

/*
Id 总线号
BusNUm 总线号
RegNum 寄存器数量
FlagNum 标志位数量
SendRegAddr 发送寄存器地址
RecvRegAddr 接收寄存器地址
FlagRegAddr 标志寄存器地址
MaxBatchLen 最大批处理长度
MaxDataLen 最大数据长度
MaxOffsetWidth 最大偏移宽度
MaxLengthWidth 最大长度宽度
"Hisport": {
    "bmc.dev.Bus.Hisport": {
        "Id": 1,
        "BusNUm": 128,
        "RegNum": 10,
        "FlagNum": 2,
        "SendRegAddr": 00,
        "RecvRegAddr": 16,
        "FlagRegAddr": 26,
        "MaxBatchLen": 2,
        "MaxDataLen": 1024,
        "MaxOffsetWidth": 2,
        "MaxLengthWidth": 2
    }
}
*/

namespace dev {

class Hisport_object : public mc::engine::object<Hisport_object> {
public:
    MC_OBJECT(Hisport_object, "Hisport", "${object_name}", (Interface_Hisport))

    Hisport_object()  = default;
    ~Hisport_object() = default;
    bool    init(mc::mutable_dict& csr_object, const mc::dict& connector);
    uint8_t get_id();

    Interface_Hisport m_interface_hisport;
};

} // namespace dev

#endif // HISPORT_H
